import request from '@/utils/request.js'

const blogApi = {
    list(blogQuery) {
        return request.get('/blog/list', {params: blogQuery})
    },
    deleteById(id) {
        return request.delete(`/blog/deleteById/${id}`)
    },
    deleteAll(ids) {
        return request.delete(`/blog/deleteAll/${ids}`)
    },
    add(blog) {
        //blog以JSON形式传递到后台
        return request.post(`/blog/add`, blog)
    },
    selectById(id) {
        return request.get(`/blog/selectById/${id}`)
    },
    update(blog) {
        return request.put(`/blog/update`, blog)
    },
    updateStatus(id, status) {
        return request.put(`/blog/updateStatus/${id}/${status}`)
    },
    exportExcel() {
        return request({
            url: '/blog/exportExcel',
            method: 'get',
            responseType: 'blob',
        })
    }
}

export default blogApi